

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using JTC.MiniCommerce.Localization;
using JTC.MiniCommerce.Store.Web.Controls;
using SubSonic.Utilities;

namespace JTC.MiniCommerce.Web.install.controls {
  public partial class connectionstring : AdminControl {
  
    int step = 0;
    
    protected void Page_Load(object sender, EventArgs e) {
      step = Utility.GetIntParameter("step");

			//string connectionString = string.Format("<add name=\"MiniCommerce\" connectionString=\"{0}\" providerName=\"System.Data.SqlClient\" />", Session["ConnectionString"]);
      string connectionString = string.Format("<add name=\"MiniCommerce\" connectionString=\"{0}\" providerName=\"System.Data.SqlClient\" />", Session["ConnectionString"]);
      lblConnectionString.Text = HttpUtility.HtmlEncode(connectionString);
      
      LocalizationUtility.AddPanelText(pnlConnectionStringSetup);
      LocalizationUtility.AddLabelText(lblConnectionStringInstructions);
      LocalizationUtility.AddButtonText(btnNext);
      LocalizationUtility.AddButtonText(btnPrevious);  
      
    }

    protected void btnNext_Click(object sender, EventArgs e) {
      try {
        Response.Redirect(string.Format("~/install/install.aspx?step={0}", step + 1), true);
      }
      catch(Exception ex) {
        MasterPage.MessageCenter.DisplayCriticalMessage(LocalizationUtility.GetCriticalMessageText(ex.Message));
      }
    }

    protected void btnPrevious_Click(object sender, EventArgs e) {
      try {
        Response.Redirect(string.Format("~/install/install.aspx?step={0}", step - 1), true);
      }
      catch(Exception ex) {
        MasterPage.MessageCenter.DisplayCriticalMessage(LocalizationUtility.GetCriticalMessageText(ex.Message));
      }
    }        
  }
}